package com.acmen.easyapi.web;


import com.acmen.easyapi.repository.AppRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;

/**
 * @author acmen
 * 接口文档服务
 * @date 2022-03-16
 */
@Controller
public class IndexController {
    @Autowired
    private AppRepository appRepository;


    @RequestMapping(value = {"/index","/"}, method = RequestMethod.GET)
    public String index(HttpServletRequest request, ModelMap model) {
        model.put("contextPath", request.getContextPath());
        model.put("apps", appRepository.getAll());
        return "/index";
    }
}
